<?php

/**
 * This is the model class for table "sys_service_site_info".
 *
 * The followings are the available columns in table 'sys_service_site_info':
 * @property integer $site_id
 * @property string $site_name
 * @property string $site_auth_key
 * @property integer $site_created
 * @property string $site_url
 * @property string $site_isvalid
 * @property integer $site_expriced
 * @property string $site_program_version
 */
class ServiceSiteInfo extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return ServiceSiteInfo the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sys_service_site_info';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('site_name, site_auth_key, site_url', 'required'),
			array('site_created, site_expriced', 'numerical', 'integerOnly'=>true),
			array('site_name, site_auth_key, site_url', 'length', 'max'=>150),
			array('site_isvalid', 'length', 'max'=>1),
			array('site_program_version', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('site_id, site_name, site_auth_key, site_created, site_url, site_isvalid, site_expriced, site_program_version', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'site_id' => 'Site',
			'site_name' => 'Site Name',
			'site_auth_key' => 'Site Auth Key',
			'site_created' => 'Site Created',
			'site_url' => 'Site Url',
			'site_isvalid' => 'Site Isvalid',
			'site_expriced' => 'Site Expriced',
			'site_program_version' => 'Site Program Version',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('site_id',$this->site_id);
		$criteria->compare('site_name',$this->site_name,true);
		$criteria->compare('site_auth_key',$this->site_auth_key,true);
		$criteria->compare('site_created',$this->site_created);
		$criteria->compare('site_url',$this->site_url,true);
		$criteria->compare('site_isvalid',$this->site_isvalid,true);
		$criteria->compare('site_expriced',$this->site_expriced);
		$criteria->compare('site_program_version',$this->site_program_version,true);

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));
	}
}